//
//  ZFBTabBarController.m
//  01-ZFB
//
//  Created by My Mac on 2017/6/1.
//  Copyright © 2017年 MyMac. All rights reserved.
//

#import "ZFBTabBarController.h"
#import "ZFBHomeViewController.h"
#import "ZFBBusinessViewController.h"
#import "ZFBFriendsViewController.h"
#import "ZFBMineViewController.h"
#import "ZFBNavigationController.h"

@interface ZFBTabBarController ()

@end

@implementation ZFBTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addChildViewController:[ZFBHomeViewController new] tabBarItemTitle:@"支付宝" itemImgName:@"TabBar_HomeBar" itemSelectedImgName:@"TabBar_HomeBar_Sel"];
    [self addChildViewController:[ZFBBusinessViewController new] tabBarItemTitle:@"口碑" itemImgName:@"TabBar_Businesses" itemSelectedImgName:@"TabBar_Businesses_Sel"];
     [self addChildViewController:[ZFBFriendsViewController new] tabBarItemTitle:@"朋友" itemImgName:@"TabBar_Friends" itemSelectedImgName:@"TabBar_Friends_Sel"];
    [self addChildViewController:[ZFBMineViewController new] tabBarItemTitle:@"我" itemImgName:@"TabBar_Assets" itemSelectedImgName:@"TabBar_Assets_Sel"];
}

-(void)addChildViewController:(UIViewController *)viewController tabBarItemTitle:(NSString *)title itemImgName:(NSString *)itemImgName itemSelectedImgName:(NSString *)itemSelectedImgName{
    UITabBarItem * tabBarItem = [[UITabBarItem alloc]initWithTitle:title image:[UIImage imageNamed:itemImgName] selectedImage:[[UIImage imageNamed:itemSelectedImgName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    viewController.tabBarItem = tabBarItem;
    viewController.view.backgroundColor = [UIColor whiteColor];
    ZFBNavigationController * nav = [[ZFBNavigationController alloc]initWithRootViewController:viewController];
    viewController.navigationItem.title = title;
    //取消半透明效果
    self.tabBar.translucent = NO;
    [self addChildViewController:nav];
}

@end
